<template>
  <span>
    <el-input
      v-bind="$attrs"
      readonly
      placeholder="请选择公司"
      v-on="$listeners">
      <el-button v-if="editable" slot="append" icon="el-icon-search" @click="selectCpy" />
    </el-input>
    <custom-supply-select-list v-if="editable" ref="customSupplySelectList" :multi-select="multiSelect" :cpy-owner-type="cpyOwnerType" @customSupplySelectCallback="customSupplySelectCallback" />
  </span>
</template>

<script>
import CustomSupplySelectList from '@/views/base/customsupply/module/customSupplySelectList'

export default {
  components: { CustomSupplySelectList },
  props: {
    multiSelect: {
      type: Boolean,
      default: true,
      required: false
    },
    cpyOwnerType: {
      type: String,
      default: 'custom', // custom, supply, ALL
      required: false
    },
    editable: {
      type: Boolean,
      default: true,
      required: false
    }
  },
  data() {
    return {
    }
  },
  mounted() {
  },
  methods: {
    selectCpy() {
      const _this = this.$refs.customSupplySelectList
      _this.initLoadData()
    },
    customSupplySelectCallback(selectedRow, selectObj) {
      this.$emit('customSupplySelectCallback', selectedRow, selectObj)
    }
  }
}
</script>
